<?php

/**
 * NOTICE OF LICENSE
 *
 * THIS SOURCE FILE IS PART OF EVEBIT'S PRIVATE PROJECT.
 * 
 * DO NOT USE THIS FILE IN OTHER PLACE.
 *
 * @category    ChinaWanderer
 * @package     Application
 * @author      Cheng Wei <berlios.o@gmail.com>
 * @version     $$Id: Bootstrap.php 20 2010-12-18 09:35:07Z cheng.wei $$
 * @copyright   Copyright (c) 2008 Evebit Inc. China (http://www.evebit.com)
 */

// Set error reporting level
error_reporting(E_ALL & ~E_STRICT);

define('DS', DIRECTORY_SEPARATOR);
define('PS', PATH_SEPARATOR);
define('AP', dirname(__FILE__));
define('RP', dirname(AP));
define('LP', RP . DS . 'library');

define('PP', RP . DS . 'public');

// Set library as include_path
$tokens = array(AP . DS . 'lib', LP, LP . DS . 'pearlib', LP . DS . 'tcpdf',get_include_path());
if (($path = getenv('LIBRARY_PATH'))) {
	array_unshift($tokens, $path);
}
set_include_path(implode(PS, $tokens));

// Define path to application directory
define('APPLICATION_PATH', AP);

if (!defined('APPLICATION_ENV')) {
	// Define application environment
	define('APPLICATION_ENV', 
		(getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'staging'));
}

/** Zend_Application */
require_once 'Evebit/Application.php';

// Create application, bootstrap, and run
$application = new Evebit_Application(APPLICATION_ENV, AP . '/configs');


// init log and cache first
$application->bootstrap('log')->bootstrap('cache');

$application->bootstrap()->run();